import threading
import time


def get_detail_html(url):
    print("html start")
    time.sleep(2)
    print("html end")


def get_detail_url(url):
    print("url start")
    time.sleep(4)
    print("url end")


class GetDetailHtml(threading.Thread):
    def __init__(self, name):
        super().__init__(name=name)

    def run(self):
        print("html start")
        time.sleep(2)
        print("html end")


class GetDetailUrl(threading.Thread):
    def __init__(self, name):
        super().__init__(name=name)

    def run(self):
        print("url start")
        time.sleep(2)
        print("url end")


if __name__ == '__main__':
    # t1 = threading.Thread(target=get_detail_html, args=("", ))
    # t2 = threading.Thread(target=get_detail_url, args=("", ))
    # # t1.setDaemon(True)
    # # t2.setDaemon(True)
    # start = time.time()
    # t1.start()
    # t2.start()
    # t1.join()
    # t2.join()
    # print("cost time:{}".format(time.time() - start))
    t1 = GetDetailHtml("get_html")
    t2 = GetDetailUrl("get_url")
    start = time.time()
    t1.start()
    t2.start()
    t1.join()
    t2.join()

